// XML support, wrapping tinyxml and tinyxpath
// Copyright 2006 (C) Ralph Thomas

#ifndef MISSION_UTIL_XML_H
#define MISSION_UTIL_XML_H

#include <tinyxml.h>
#include <boost/shared_ptr.hpp>

namespace util {
	typedef boost::shared_ptr<TiXmlDocument>	xml_doc_t;
	typedef boost::shared_ptr<TiXmlElement>		xml_node_t;
	//
	/// Parse the XML in from the given string and return a document
	/// object. This method will throw an exception if the given XML
	/// is bad.
	///
	/// \param	xml	the XML to parse.
	/// \return	an xml_doc_t representing the parsed XML.
	//
	xml_doc_t parse_xml( const std::string& xml );
	//
	/// Return a string for the given XPath expression and node to
	/// operate on.
	///
	/// \param	n	the XML node to base the XPath from.
	/// \param	xpath	the XPath expression to evaluate.
	/// \return	the result of the XPath expression.
	//
//	std::string xpath_eval_string( const xml_node_t& n, const std::string& xpath );
	std::string xpath_eval_string( TiXmlElement* n, const std::string& xpath );
}

#endif

